package game.sloto;

import java.net.InetSocketAddress;

import org.apache.mina.core.filterchain.DefaultIoFilterChainBuilder;
import org.apache.mina.filter.codec.ProtocolCodecFilter;
import org.apache.mina.filter.logging.LoggingFilter;
import org.apache.mina.transport.socket.nio.NioSocketAcceptor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class Main {
    private static final int PORT = 8072;
    
    private static final int POLICY_PORT = 843;
    
    
	Logger logger = LoggerFactory.getLogger(Main.class);
	
	/**
	 * @param args
	 */
	public static void main(String[] args) throws Exception {
		NioSocketAcceptor policyAcceptor = new NioSocketAcceptor();
		policyAcceptor.getFilterChain().addLast("logger", new LoggingFilter());
		policyAcceptor.setHandler(new FlashPolicyHandler());
		policyAcceptor.bind(new InetSocketAddress(POLICY_PORT));
		
		NioSocketAcceptor acceptor = new NioSocketAcceptor();
		DefaultIoFilterChainBuilder chain = acceptor.getFilterChain();
		chain.addLast("logger", new LoggingFilter());
		chain.addLast("codec", new ProtocolCodecFilter(new SlotoCodecFactory()));
        acceptor.setHandler(new SlotoHandler());
        acceptor.bind(new InetSocketAddress(PORT));
	}
}
